//
// Created by tacom on 2024/9/26.
//

#include "io_helper.h"

// led status
static bool LED_STATUS = true;

void led_init(){
    gpio_init(PICO_DEFAULT_LED_PIN);
    gpio_set_dir(PICO_DEFAULT_LED_PIN, GPIO_OUT);
}

void init_ask_pin(){
    gpio_set_dir(SPI_ASK_RECEIVE_PIN, GPIO_OUT);
    gpio_put(SPI_ASK_RECEIVE_PIN, 1);
    gpio_set_function(SPI_ASK_RECEIVE_PIN, GPIO_FUNC_SIO);
}

void helper_io_init(){
    init_ask_pin();
    led_init();
}

void set_ask_pin_level(bool level){
    gpio_put(SPI_ASK_RECEIVE_PIN, level);
}

void led_blink(){
    gpio_put(PICO_DEFAULT_LED_PIN, LED_STATUS);
    LED_STATUS = !LED_STATUS;
}

